package com.example.demo.entity;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
* @author zjj
* @date 2020-05-06
*/
@Entity
@Setter
@Getter
@IdClass(RolesMenusPK.class)
@Table(name="t_roles_menus")
@org.hibernate.annotations.Table(appliesTo = "t_roles_menus",comment="菜单角色关联")
public class RolesMenus implements Serializable {

    /** 菜单ID */
    @Id
    @Column(name = "menu_id")
    private Long menuId;

    /** 角色ID */
    @Id
    @Column(name = "role_id")
    private Long roleId;

    public void copy(RolesMenus source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}